{% extends 'base.html' %}

{% block main %}

    <article class="post post-1">
        <header class="entry-header">
            <h1 class="entry-detail-title">{{ article.title }}</h1>
            <div class="entry-meta entry-meta-center">
                <span class="post-category"><a href="{% url 'blog:category' pk=article.category.pk %}">{{ article.category }}</a></span>
                <span class="post-date"><a href="#"><time class="entry-date"
                                                          datetime="{{ article.create_time }}">{{ article.create_time|date:'Y-m-d H:i:s' }}</time></a></span>
                <span class="post-author"><a href="#">{{ article.author }}</a></span>
                <span class="comments-link"><a href="{{ article.get_absolute_url }}#comment-area">{{ article.comment_set.count }} 评论</a></span>
{#                <span class="views-count"><a href="#">{{ article.view_count }} 阅读</a></span>#}
                <span class="views-count"><a>{{ article.view_count }} 阅读</a></span>
            </div>
        </header>
        <div class="entry-content clearfix">
            {{ article.body |safe }}
            <div class="widget-tag-cloud">
                <ul>
                    标签：
                    {% for tag in article.tags.all %}
                        <li><a style="border:0;" href="{% url 'blog:tag' pk=tag.pk %}">{{ tag.name }}</a></li>
                    {% endfor %}
                </ul>
            </div>
        </div>
    </article>
    <hr>
    <section class="comment-area" id="comment-area">

        <h3>发表评论</h3>
        <form action="{% url 'comments:comment' pk=article.pk %}" method="post" class="comment-form">
            {% csrf_token %}
            <div class="row">
                <div class="col-md-4">
                    <label for="{{ form.name.id_for_lable }}">名字：</label>
                    {{ form.name }}
                    {{ form.name.errors }}
                </div>
                <div class="col-md-4">
                    <label for="{{ form.email.id_for_lable }}">邮箱：</label>
                    {{ form.email }}
                    {{ form.email.errors }}
                </div>
                <div class="col-md-4">
                    <label for="{{ form.url.id_for_lable }}">网址：</label>
                    {{ form.url }}
                    {{ form.url.errors }}
                </div>
                <div class="col-md-12">
                    <label for="{{ form.content.id_for_lable }}">评论：</label>
                    {{ form.content }}
                    {{ form.content.errors }}
                    <button type="submit" class="comment-btn">发表</button>
                </div>
            </div>    <!-- row -->
        </form>
        {#    comment start    #}
        <div class="comment-list-panel">
            <h3>评论列表，共 <span>{{ article.comment_set.count }}</span> 条评论</h3>
            <ul class="comment-list list-unstyled">
                {% for comment in comment_list %}
                    <li class="comment-item">
                        <span class="nickname">{{ comment.name }}</span>
{#                        <time class="submit-date" datetime="{{ comment.create_time }}">{{ comment.create_time | date:"Y-m-d H:i:s" }}</time>#}
                        <time class="submit-date" datetime="{{ comment.create_time }}">{{ comment.create_time }}</time>
                        <div class="text">
                            {{ comment.content }}
                        </div>
                    </li>
                    {% empty %}
                    暂无评论
                {% endfor %}
            </ul>
        </div>
    </section>
{% endblock main %}

{% block markdown_toc %}
    <div class="widget widget-content">
        <h3 class="widget-title">文章目录</h3>
        {{ article.toc|safe }}
    </div>
{% endblock markdown_toc %}
